import {NTooltip,PopoverPlacement,PopoverTrigger} from 'naive-ui';
import {Component, ComponentProps, VueComponent} from "vue3-oop";

interface IProps {
  title?:string
  placement?:PopoverPlacement
  trigger?:PopoverTrigger
}
@Component()
export default class Tips extends VueComponent<IProps> {
  static defaultProps: ComponentProps<IProps> = ['title','placement','trigger']

  constructor(
  ) {
    super();
  }

  render() {
    const slots = useSlots();
    const {placement,trigger} = this.props;
    const nTooltipProps = { placement,trigger };
    return (
      <NTooltip {...nTooltipProps}>
        {{
          default: () => <span>{this.props.title}</span>,
          trigger: () => slots.default!()
        }}
      </NTooltip>
    )
  }
}
